package com.samsung.seleccion;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.Toast;

import com.samsung.R;

public class MyWebView4 extends Activity implements OnClickListener {
	/** Called when the activity is first created. */

	Codigo codigo; // = new Codigo();
	ImageButton buttonFoward;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		codigo = new Codigo(this);
		setContentView(R.layout.viewweb);

		WebView browser = (WebView) findViewById(R.id.webView1);

		// binding the UI's controls defined in "main.xml" to Java code
		buttonFoward = (ImageButton) findViewById(R.id.BtnAdelantarWeb);

		// LISTENER: wiring the button widget to events-&-code
		buttonFoward.setOnClickListener(this);

		browser.getSettings().setJavaScriptEnabled(true);

		browser.addJavascriptInterface(codigo, "codigo");
		browser.getSettings().setBuiltInZoomControls(true);
		browser.setHorizontalScrollBarEnabled(true);
		browser.setInitialScale(40);
		browser.loadUrl("file:///android_asset/Imagen4.html");
	}

	@Override
	public void onClick(View target) {
		switch (target.getId()) {
		case R.id.BtnAdelantarWeb:
			Intent intent;		
			intent = new Intent("com.samsung.seleccion.MYWEBVIEW5");		
	        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
	        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
	        startActivity(intent);
	        break;	  
		}		
	}// onClick
	
}